/*
 * @Author: LG
 * @Date: 2021-07-21 10:20:45
 * @Description: 
 * @Last Modified By: liu.guo
 * @Last Modified Time: 2021-07-21 10:59:42
 */
import Vue from 'vue'
export default function(el,binding){
  if(el.hasIcon) return 
  // console.log()
  const iconElement = structureIcon(binding.arg,binding.value)
  el.appendChild(iconElement)
  el.hasIcon =true
}
const structureIcon =(content,attrs)=>{
  let attrStr = ''
  for (let key in attrs) {
    attrStr += `${key}=${attrs[key]} `
  }
  console.log(attrs,attrStr)
  const a = `<el-tooltip content='${content}' ${attrStr}><i class='el-icon-question'></i></el-tooltip> `
  const tooltip =Vue.extend({template:a})
  const component = new tooltip().$mount()
  return component.$el
}